package com.barneyx.mshinfoplatform.entity.info.article;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.barneyx.mshinfoplatform.entity.AreaCommonEntity;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.TableCharset;
import com.gitee.sunchenbin.mybatis.actable.annotation.TableEngine;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlCharsetConstant;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlEngineConstant;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "msh_article_attr_list", autoResultMap = true)
@TableCharset(MySqlCharsetConstant.UTF8MB4)
@TableEngine(value = MySqlEngineConstant.MyISAM)
public class ArticleAttrEntity extends AreaCommonEntity {
    @TableId(value = "article_id", type = IdType.INPUT)
    @Column(type = MySqlTypeConstant.BIGINT)
    private String ArticleAttrId;

    @ApiModelProperty("信息图册")
    @TableField(value = "albums", typeHandler = JacksonTypeHandler.class)
    @Column(type = MySqlTypeConstant.JSON)
    private JSONArray Albums;


    @ApiModelProperty("信息视频")
    @TableField("video")
    private String Video;


    @TableField("article_content")
    @Column(type = MySqlTypeConstant.LONGTEXT)
    private String ArticleContent;


    public boolean getIsAlbums() {
        return getAlbums().size() > 0;
    }

}
